package jianzhiOffer;

public class num16 {
    public double myPow(double x, int n) {
        if(x == 0) return x;
        long b = n;
        double temp = 1.0;
        if(n < 0) {
            x = 1 / x;
            b = -b;
        }
        while(b > 0) {
            if(b % 2 == 1) {
                temp = (temp * x);
            }
            x = x * x;
            b = b >> 1;
        }
        return temp;
    }
}
